# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
# All rights reserved.
# This component and the accompanying materials are made available
# under the terms of the License "Eclipse Public License v1.0"
# which accompanies this distribution, and is available
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
#
# Initial Contributors:
# Nokia Corporation - initial contribution.
#
# Contributors:
#
# Description:
# ARMv5 EXE/DLL ABIv2 Function Like Makefile (FLM)
# Build an e32 EXE with exports
# 
#

ifeq ($(TARGETTYPE),exexp)
include $(FLMHOME)/e32abiv2defaults.mk

# What we need to build an EXEXP
CANHAVEEXPORTS:=1
POSTLINKTARGETTYPE:=EXEXP
POSTLINKFILETYPE:=exe
DOPOSTLINK:=1
EPOCALLOWDLLDATA:=1
CANIGNORENONCALLABLE:=1

$(call vsave,CDEFS)
# Determine what kind of entrypoint option to set
FIRSTLIB_OBJECTFILE=uc_exe_.o
STATIC_RUNTIME_LIB:=$(USER_STATIC_RUNTIME_LIB)

ifeq ($(FIRSTLIB),)
FIRSTLIB:=eexe.lib
else
ifneq ($(findstring kc_exe,$(FIRSTLIB))$(findstring KC_EXE,$(FIRSTLIB)),)
STATIC_RUNTIME_LIB:=$(KERNEL_STATIC_RUNTIME_LIB)
CDEFS:=$(CDEFS) __KERNEL_MODE__
FIRSTLIB_OBJECTFILE=k_entry_.o
# Kernel code builds as arm
ALWAYS_BUILD_AS_ARM:=1
# No exception support for kernel code
EXCEPTIONS:=$(NO_EXCEPTIONS)
# No dedicated library for operator new/delete functions.
HAS_DEDICATED_OP_NEWDEL_LIB:=

endif
endif

LINKER_ENTRYPOINT_LIBDEP:=$(STATIC_RUNTIME_DIR)/$(FIRSTLIB)

ifeq ("$(TOOLCHAIN)","RVCT")
LINKER_ENTRYPOINT_SETTING:=$(LINKER_ENTRYPOINT_PREFIX)$(ENTRYPOINT) $(call dblquote,$(STATIC_RUNTIME_DIR)/$(FIRSTLIB)($(FIRSTLIB_OBJECTFILE)))
else
# GCC
LINKER_ENTRYPOINT_SETTING:=$(LINKER_ENTRYPOINT_PREFIX)$(ENTRYPOINT) -Wl,-u$(LINKER_SEPARATOR)$(LINKER_ENTRYPOINT_PREFIX)$(ENTRYPOINT)$(LINKER_SEPARATOR)$(call dblquote,$(STATIC_RUNTIME_DIR)/$(FIRSTLIB))
endif

POSTLINKDEFFILE:=$(DEFFILE)
SUPPORT_FREEZE:=1
ifeq ($(NOEXPORTLIBRARY),)
IMPORTLIBRARYREQUIRED:=1
else
IMPORTLIBRARYREQUIRED:=
endif


CDEFS:=$(CDEFS) __EXE__
include $(FLMHOME)/e32abiv2.flm
$(call vrestore)


else
$(error $e32abiv2exexp.flm called with wrong TARGETTYPE (should be 'exexp' but is '$(TARGETTYPE)'))
endif

